/* import the fontawesome core */
import { library } from '@fortawesome/fontawesome-svg-core'
/* import font awesome icon component */
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
/* import specific icons */
import { fas } from '@fortawesome/free-solid-svg-icons'
/* add icons to the library */
library.add(fas)
// 引入样式
import './styles/index.scss'
// 引入自定义组件 
import Icon from './components/Icon/Icon.vue'
import Button from './components/Button/Button.vue'
import Card from './components/Card/Card.vue'
import Dialog from './components/Dialog/Dialog.vue'
import Pager from './components/Pager/Pager.vue'
import Collapse from './components/Collapse/Collapse.vue'
import CollapseItem from './components/Collapse/CollapseItem.vue'
import Tooltip from './components/Tooltip/Tooltip.vue'
import Dropdown from './components/Dropdown/Dropdown.vue'
import type { App, Component } from 'vue'

// 提供一个install方法

const componentsArr: Component[] = [
    Icon,
    Button,
    Card,
    Dialog,
    Pager,
    Collapse,
    CollapseItem,
    Tooltip,
    Dropdown
]
// 这个就是我们要对外提供的install方法
const install = (app: App) => {
    componentsArr.forEach(component => {
        app.component(component.name || '', component)
    })
    app.component('font-awesome-icon', FontAwesomeIcon)
}
// 全部导出
export default {
    install
}
// 按需导出
export {
    install, Icon,
    Button,
    Card,
    Dialog,
    Pager,
    Collapse,
    CollapseItem,
    Tooltip,
    Dropdown
}